package com.pinyougou.manager.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Title :登陆模块
 *
 * @Project PinYouGou
 * @Description TODD
 * @Author 哈哈怪
 * @Date 2018/9/13 13:07
 **/
@RestController
@RequestMapping("login")
public class LoginController {

    /**
     *
     * 功能描述: 在首页显示用户名称
     *
     * @param: []
     * @return: java.util.Map
     * @auther: 哈哈怪
     * @date: 2018/9/13 13:10
     */
    @RequestMapping("/name")
    public Map showName(){

        String name = SecurityContextHolder.getContext().getAuthentication().getName();
        Map<String,Object> map = new HashMap<>();
        map.put("loginName",name);
        return map;
    }
}
